@inject('appRepository', 'App\Repositories\AppRepository')
@php
    $newsContents = $appRepository->getContentByColumn('ContentBlog',10,'新闻页','最热新闻');
    $newsActives = $appRepository->getContentByColumn('ContentBlog',10,'新闻页','最新活动');
    $left = $appRepository->getContentByColumn('ContentPicture',1,'新闻页','侧栏广告位');
@endphp
<div class="row">
    @if($newsContents && count($newsContents)>0)
        <div class="content-title mt-3">
            <div class="content-title-img">
                <div class="news-list-title"><h3>最热新闻</h3></div>
            </div>
        </div>
        <div class="left-body mt-4">
            <ul class="list-group ">
                @foreach($newsContents as $key => $item)
                    @if($key == 0)
                        <li class="list-group-item">
                            <div class="media">
                                <img class="mr-3" src="{{$item->content_detail->asset->path}}"
                                     alt="Generic placeholder image">
                                <div class="media-body mt-2">
                                    <a href="{{url('content',['contentId'=>$item->id])}}">
                                        <h5 class="mt-0">{{$item->title}}</h5></a>
                                </div>
                            </div>
                        </li>
                    @elseif($key <3)
                        <li class="list-group-item">
                            <div class="mt-2">
                                <span class="point d-inline-block">{{$key+1}}</span>
                                <a href="{{url('content',['contentId'=>$item->id])}}">
                                    <h5 class="text-o m-0 d-inline-block"> {{$item->title}}</h5>
                                </a>
                            </div>
                        </li>
                    @else
                        <li class="list-group-item">
                            <div class="mt-2">
                                <a href="{{url('content',['contentId'=>$item->id])}}">
                                    <h5 class="text-o m-0 d-inline-block"> {{$item->title}}</h5>
                                </a>
                            </div>
                        </li>

                    @endif
                @endforeach
            </ul>
        </div>
    @endif
    @if($left && count($left)>0)
        <div class="picture-box my-5">
            <a href="{{$item->content_detail->point_url}}">
            <img src="{{$left[0]->content_detail->assets_path}}" alt="">
            </a>
        </div>
    @endif
    @if($newsActives && count($newsActives)>0)
        <div class="content-title mt-3">
            <div class="content-title-img">
                <div class="news-list-title"><h3>最新活动</h3></div>
            </div>
        </div>
        <div class="left-body mt-4">
            <ul class="list-group ">
                @foreach($newsActives as $key => $item)
                    @if($key == 0)
                        <li class="list-group-item">
                            <div class="media">
                                <img class="mr-3" src="{{$item->content_detail->asset->path}}"
                                     alt="Generic placeholder image">
                                <div class="media-body mt-2">
                                    <a href="{{url('content',['contentId'=>$item->id])}}">
                                        <h5 class="mt-0">{{$item->title}}</h5></a>
                                </div>
                            </div>
                        </li>
                    @elseif($key <3)
                        <li class="list-group-item">
                            <div class="mt-2">
                                <span class="point d-inline-block">{{$key+1}}</span>
                                <a href="{{url('content',['contentId'=>$item->id])}}">
                                    <h5 class="text-o m-0 d-inline-block"> {{$item->title}}</h5>
                                </a>
                            </div>
                        </li>
                    @else
                        <li class="list-group-item">
                            <div class="mt-2">
                                <a href="{{url('content',['contentId'=>$item->id])}}">
                                    <h5 class="text-o m-0 d-inline-block"> {{$item->title}}</h5>
                                </a>
                            </div>
                        </li>

                    @endif
                @endforeach
            </ul>
        </div>
    @endif
</div>